Skip to content

Simplify fsst_compress_offsets_overflow_i32 test with empty compressor#8158

Open
joseph-isaacs wants to merge 2 commits into
developfrom
claude/great-feynman-EqrcJ
Open

Simplify fsst_compress_offsets_overflow_i32 test with empty compressor#8158
joseph-isaacs wants to merge 2 commits into
developfrom
claude/great-feynman-EqrcJ

Conversation

@joseph-isaacs
Copy link
Copy Markdown
Contributor

Summary

Refactor the fsst_compress_offsets_overflow_i32 test to use an empty FSST compressor instead of training one on random data. This simplification:

  1. Reduces memory allocation from ~5 GiB to ~3.4 GiB by eliminating the random data pool and using deterministic escape-based expansion (2x input size) instead of incompressible random data (~1x input size).

  2. Removes randomness by replacing StdRng and random pool generation with a single reused buffer of repeated bytes, making the test deterministic and faster.

  3. Maintains regression coverage by exercising the same output-offset overflow path. The empty compressor's escape factor (2x + 7 bytes) is the worst-case FSST expansion, so this is the cheapest way to reach the i32::MAX boundary while still crossing it.

  4. Adds explicit assertion that compressed output actually exceeds i32::MAX, preventing silent test degradation if FSST's escape behavior changes.

The test still allocates ~1.1 GiB of input and ~2.25 GiB of output, so it remains gated to CI and respects VORTEX_SKIP_SLOW_TESTS.

Testing

Existing test infrastructure covers this change. The test is gated to CI runs and validates that the regression (i32 offset overflow in FSST output) is properly exercised by asserting the compressed byte count exceeds i32::MAX.

https://claude.ai/code/session_01212r9Sii7DxuVZ1UJ9oqx1

The fsst_compress_offsets_overflow_i32 regression compressed ~2.5 GiB of
random, incompressible data with a trained compressor to push cumulative
FSST output past i32::MAX. Profiling the debug build (samply) showed ~90%
of runtime in fsst::Compressor::compress_into and ~18 s in per-byte RNG
pool generation.

Use an empty FSST compressor instead: with no symbols every byte is
emitted as a two-byte escape, so output is deterministically 2x the
input. That crosses the i32::MAX boundary with only ~1.1 GiB of input
(no random data needed), which is the cheapest possible way to reach the
boundary since escapes are FSST's worst-case expansion. The test now also
asserts the actual compressed byte size exceeds i32::MAX so it cannot
silently stop covering the regression.

Measured (debug, single run): 307 s -> 186 s (~1.65x), peak memory
~5 GiB -> ~3.4 GiB, RNG generation eliminated.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
/// The input is built with [`VarBinBuilder<i64>`] so the input itself does not panic, which
/// confirms the overflow is on the FSST output side. After the fix the test must succeed
/// with the row count preserved.
/// We force the output past [`i32::MAX`] with an empty FSST compressor: it has no symbols, so
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this test the best documented part of the codebase?

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 29, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 1275 untouched benchmarks


Comparing claude/great-feynman-EqrcJ (579afe6) with develop (73454db)

Open in CodSpeed

Give fsst_compress_offsets_overflow_i32 priority 100 so nextest schedules
it at the start of the workspace run, mirroring the existing
compress_large_int override. The test still takes ~3 minutes; dispatching
it first lets its latency overlap with the rest of the suite instead of
trailing at the end as the long pole.

Verified locally with nextest 0.9.137: the filter selects exactly this
test, and a controlled --test-threads=1 experiment confirmed priority=100
moves a normally-last test to first in dispatch order.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants